package drds.data_propagate.binlog.event;

import drds.data_propagate.binlog.BinLogEvent;
import drds.data_propagate.binlog.Buffer;

/**
 * Delete_file_log_event.
 *
 * @author <a href="mailto:changyuan.lh@taobao.com">Changyuan.lh</a>
 * @version 1.0
 */
public final class DeleteFileEvent extends BinLogEvent {

    /* DF = "Delete File" */
    public static final int DF_FILE_ID_OFFSET = 0;
    private final long fileId;

    public DeleteFileEvent(Header header, Buffer buffer, FormatDescriptionEvent formatDescriptionEvent) {
        super(header);

        final int commonHeaderLength = formatDescriptionEvent.commonHeaderLength;
        buffer.position(commonHeaderLength + DF_FILE_ID_OFFSET);
        fileId = buffer.getUint32(); // DF_FILE_ID_OFFSET
    }

    public final long getFileId() {
        return fileId;
    }
}
